macros: charecterization tests for ? operator fail #7069
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When a
?
operator is used in a tokio entry point function (wrapped in#[tokio::main]
), which has a Option or Result return type, but wherethe function does not actually return that type correctly, currently the
compiler returns two errors instead of just one. The first of which is
incorrect and only exists due to the macro expanding to an async block.
This commit is a characterization test for this behavior to help show
when it's fixed (or even changed for better / worse)
Motivation
Annoyed by incorrect error message. "cannot use the
?
operator in an async block that returns()
". More specifically, when editing code in ways that break the code (by changing return values, or changing the order of things, seeing error messages that aren't actually relevant to fixes can be annoying, particularly in situations where these errors are reported inline to the code. There's a small amount of time where the brain leaves the problem at hand and moves into solve the bug mode, which is unnecessary (and hence worth addressing)More details at #6930 (comment)
Solution
This PR is about just identifying and capturing the problem. It can be merged as-is, or can be left open while considering the options to fix this.